\begin{frame}
    \frametitle{Advanced Compiler Optimizations}
    \begin{itemize}
        \item \emph{PGO} (\emph{Profiling Guided Optimization}) produces multi-chunked functions
        \item Problems arise when those chunks are shared by different functions (only the tail of the function)
        \item For more details refer to:
            \pedbullet{http://blog.dkbza.org/2006/12/simply-blocks-basically.html}
            \pedbullet{http://blog.dkbza.org/2007/01/binnavis-basic-block-handling.html}
    \end{itemize}
\end{frame}

\begin{frame}
    \frametitle{Basic Block Rearranging Illustrated. Unoptimized layout}
        \begin{center}
            \pgfimage[height=7cm]{images/anti_re/basic_block_sharing_optimizations_1a}
        \end{center}
\end{frame}

\begin{frame}
    \frametitle{Basic Block Rearranging Illustrated. Optimized layout}
        \begin{center}
            \pgfimage[height=6cm]{images/anti_re/basic_block_sharing_optimizations_1b}
        \end{center}
\end{frame}

\begin{frame}
    \frametitle{Basic Block Sharing Problem}
    \begin{itemize}
        \item Counter-intuitively, the same code can belong to two, otherwise logically different basic blocks.
        \item This is a side-effect of the basic-block sharing, caused when one of the functions has a branch targeting the shared code, while the other doesn't
    \end{itemize}
\end{frame}


\begin{frame}
    \frametitle{Basic Block Sharing Illustrated}
        \begin{center}
            \pgfimage[height=6cm]{images/anti_re/basic_block_sharing_optimizations_2}
        \end{center}
\end{frame}

\begin{frame}
    \frametitle{Basic Block Sharing Problem Illustrated}
        \begin{center}
            \pgfimage[height=7cm]{images/anti_re/basic_block_sharing_optimizations_3}
        \end{center}
\end{frame}

\begin{frame}
    \frametitle{Basic Block Sharing. Alternative View}
        \begin{center}
            \pgfimage[height=6cm]{images/anti_re/basic_block_sharing_optimizations_4}
        \end{center}
\end{frame}

